<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>年会抽奖</title>
  <style>
    .wrapper {
      width: 840px;
      height: 420px;
      margin: 30px auto;
      background: url(./images/bg01.jpg) no-repeat center / cover;
      padding: 100px 250px;
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  <div class="wrapper">
    <strong>传智教育年会抽奖</strong>
    <h1>一等奖：<span id="one">???</span></h1>
    <h3>二等奖：<span id="two">???</span></h3>
    <h5>三等奖：<span id="three">???</span></h5>
  </div>
  <script>
    let persons =['刘德华','张学友','郭富城','张嘉倪','梁朝伟','张小泉','刘嘉玲','梁静茹','张曼玉','刘亦菲','张艺兴']
    function getRandom(arr) {
      return Math.floor(Math.random() * arr.length)
    }
    function deletePerson(arr,index) {
      return arr.splice(index,1)
    }
    let random = getRandom(persons)
    // let random = Math.floor(Math.random() * persons.length)
    const one = document.querySelector('#one')
    one.innerHTML = persons[random]
    deletePerson(persons,random)
    console.log(persons)

    let two = document.querySelector('#two')
    random = getRandom(persons)
    two.innerHTML = persons[random]
    deletePerson(persons,random)
    console.log(persons)

    let three = document.querySelector('#three')
    random = getRandom(persons)
    three.innerHTML = persons[random]
    deletePerson(persons,random)
    console.log(persons)

  </script>
</body>

</html>